package main.serveur;

import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

import serveurChatRMI.rmi.src.ServeurForum;

public class Serveur {

	public static void main(String[] args) {

	    try {
	    	LocateRegistry.createRegistry(1099);
			
			ServeurForum ServeurForum = new ServeurForum();
	    	
	    	String url ="rmi://" + InetAddress.getLocalHost().getHostAddress() + "/serveur1";
		    System.out.println("Enregistrement de l'objet avec l'url : " + url);
			Naming.rebind(url, ServeurForum);
			
			System.out.println("Serveur lance");
			
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	

}
